package test40;

import java.io.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-05-12
 * Time: 15:39
 */
//https://www.nowcoder.com/questionTerminal/95e35e7f6ad34821bc2958e37c08918b?
public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String str = null;
        while ((str = br.readLine()) != null) {
            int num = Integer.parseInt(str);
            int[] arr = new int[21];
            arr[2] = 1;
            for (int i = 3; i <= num; i++) {
                arr[i] = (i- 1) * (arr[i - 1] + arr[i - 2]);
            }
            bw.write(arr[num] + "\n");
        }
        bw.flush();
        bw.close();
        br.close();
    }
}
